﻿using System.Runtime.InteropServices;

namespace TCommunication.Model;
/// <summary>
/// 斯康达Can帧结构体
/// </summary>
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi,Pack=1)]
public struct SkondaCanWriteFrame
{
    /// <summary>
    /// 通道
    /// </summary>
    public byte Channel;
    /// <summary>
    /// 数据长度
    /// </summary>
    public byte DataLen;
    /// <summary>
    /// 数据帧类型  bit0: 0:扩展帧，1:标准帧 默认为扩展帧
    /// </summary>
    public byte FrameType;
    /// <summary>
    /// 保留，忽略
    /// </summary>
    public byte Res;
    /// <summary>
    /// CanId
    /// </summary>
    public uint CanId;
    /// <summary>
    /// Can数据，最大8个byte
    /// </summary>
    [MarshalAs(UnmanagedType.ByValArray,SizeConst=8)]
    public byte[] Data;
    /// <summary>
    /// Crc校验
    /// </summary>
    public ushort Crc;
}